var express = require('express');
var router = express.Router();
const ProviderService = require("../services/provider/provider_service.js");

/* GET home page. */
router.get('/', function(req, res, next) {
	res.render('index', {
		title: 'Express'
	});
});

//添加
router.post('/add', ProviderService.add);

//根据商品编码查询
router.get('/find_by_prov_code',ProviderService.findByCode);

/*
 * 默认访问第一页的数据
 * 完整路径：api/providers/find_by_page
 */
router.get('/find_by_page', ProviderService.findByPage);

//根据输入的供应商名称查询数据
router.get('/find_by_prov_name', ProviderService.findByProv_name);

//修改供应商信息
router.post('/modify', ProviderService.modify);

//删除供应商
router.post('/delete', ProviderService.delete);

module.exports = router;